
package com.diboot.iam.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.diboot.core.entity.BaseEntity;
import com.diboot.core.entity.BaseTreeEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.time.LocalDateTime;

@TableName("dbt_iam_org")
public class IamOrg extends BaseTreeEntity<String> {
    @Serial
    private static final long serialVersionUID = 8942911223090443934L;
    public static final String VIRTUAL_ROOT_ID = "0";
    @JsonIgnore
    @TableField
    private String tenantId;
    @TableField
    private String parentId;
    @TableField
    private String parentIdsPath;
    @TableField
    private String rootOrgId;
    @TableField
    private @NotNull(
            message = "名称不能为空"
    ) @Length(
            max = 100,
            message = "名称长度应小于100"
    ) String name;
    @TableField
    private @NotNull(
            message = "组织类别不能为空"
    ) @Length(
            max = 100,
            message = "组织类别长度应小于100"
    ) String type;
    @TableField
    private @NotNull(
            message = "编码不能为空"
    ) @Length(
            max = 50,
            message = "编码长度应小于50"
    ) String code;
    @TableField
    private String managerId;
    @TableField
    private Long sortId;
    @TableField
    private String status;
    private String orgComment;
    @TableField(
            fill = FieldFill.INSERT_UPDATE
    )
    private LocalDateTime updateTime;

    @TableField
    private String oaNum;

    /**
     * 是否办事处
     */
    @TableField
    private byte isOffice;

    public IamOrg() {
    }

    public String getTenantId() {
        return this.tenantId;
    }

    public String getParentId() {
        return this.parentId;
    }

    public String getParentIdsPath() {
        return this.parentIdsPath;
    }

    public String getRootOrgId() {
        return this.rootOrgId;
    }

    public String getName() {
        return this.name;
    }

    public String getType() {
        return this.type;
    }

    public String getCode() {
        return this.code;
    }

    public String getManagerId() {
        return this.managerId;
    }

    public Long getSortId() {
        return this.sortId;
    }

    public String getStatus() {
        return this.status;
    }

    public String getOrgComment() {
        return this.orgComment;
    }

    public LocalDateTime getUpdateTime() {
        return this.updateTime;
    }

    @JsonIgnore
    public IamOrg setTenantId(final String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    public IamOrg setParentId(final String parentId) {
        this.parentId = parentId;
        return this;
    }

    public IamOrg setParentIdsPath(final String parentIdsPath) {
        this.parentIdsPath = parentIdsPath;
        return this;
    }

    public IamOrg setRootOrgId(final String rootOrgId) {
        this.rootOrgId = rootOrgId;
        return this;
    }

    public IamOrg setName(final String name) {
        this.name = name;
        return this;
    }

    public IamOrg setType(final String type) {
        this.type = type;
        return this;
    }

    public IamOrg setCode(final String code) {
        this.code = code;
        return this;
    }

    public IamOrg setManagerId(final String managerId) {
        this.managerId = managerId;
        return this;
    }

    public IamOrg setSortId(final Long sortId) {
        this.sortId = sortId;
        return this;
    }

    public IamOrg setStatus(final String status) {
        this.status = status;
        return this;
    }

    public IamOrg setOrgComment(final String orgComment) {
        this.orgComment = orgComment;
        return this;
    }

    public IamOrg setUpdateTime(final LocalDateTime updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public String getOaNum() {
        return oaNum;
    }

    public IamOrg setOaNum(String oaNum) {
        this.oaNum = oaNum;
        return this;
    }

    public byte getIsOffice() {
        return isOffice;
    }

    public void setIsOffice(byte isOffice) {
        this.isOffice = isOffice;
    }
}
